package runnables;

import log.Logger;
import net.rim.device.api.system.DeviceInfo;
import net.rim.device.api.ui.UiApplication;
import screens.Controller;
import test.GradeAnalyzer;



public class ActualizarPushRunnable implements Runnable{
	private int status;
	
	public ActualizarPushRunnable(int stat){
		this.status=stat;
	}

	public void run() {
		GradeAnalyzer ga = GradeAnalyzer.getInstance();
		try{
			// hash , pin
			ga.pausePushStatus(Controller.getInstance().getHash(),Integer.toHexString(DeviceInfo.getDeviceId()).toUpperCase(),this.status);
			System.out.println(Integer.toHexString(DeviceInfo.getDeviceId()).toUpperCase()+" ************* pin ");
		} catch (Exception e){
			Logger.log("change push status error");
		}
		//if everything is ok, do:
		UiApplication.getUiApplication().invokeLater(new Runnable() {
			public void run() {
				// true
				if (Controller.getInstance().getPushStatus()){
					Logger.log("push status change result: true");
				}
				else {// false
					Logger.log("push status change result: false");
				}
				
			}
		});	
	}
}
 
